package com.aya.data.decorate;

import com.aya.data.decorate.decorateimpl.Discount;
import com.aya.data.decorate.decorateimpl.Substract;
import com.aya.data.decorate.impl.Goods;

import java.math.BigDecimal;

public class Main {
    public static void main(String[] args) {
        Goods goods = new Goods();
        goods.setName("菠萝");
        goods.setPrice(BigDecimal.valueOf(10.8));
        // 10.8 满减 1.8
        IGoods igoods = new Substract(goods, BigDecimal.valueOf(1.8));
        // 折扣 8 折
        igoods = new Discount(igoods, BigDecimal.valueOf(8));
        System.out.println(igoods.price());
    }
}
